<template>
  <div>
    <el-form ref="form" :model="form" label-width="100px">
      <el-form-item label="编码">
        <el-input v-model="form.encoding"></el-input>
      </el-form-item>
      <el-form-item label="是否打印">
        <el-input v-model="form.print"></el-input>
      </el-form-item>
      <el-form-item label="列分隔符">
        <el-input v-model="form.fieldDelimiter"></el-input>
      </el-form-item>
      <el-form-item label="路径">
        <el-input v-model="form.path"></el-input>
      </el-form-item>
      <el-form-item label="文件名称">
        <el-input v-model="form.fileName"></el-input>
      </el-form-item>
      <el-form-item label="休眠次数">
        <el-input v-model="form.recordNumBeforeSleep"></el-input>
      </el-form-item>
      <el-form-item label="休眠时间">
        <el-input v-model="form.sleepTime"></el-input>
      </el-form-item>
    </el-form>
    <div style="text-align: right">
      <el-button type="primary" @click="onSubmit">保存</el-button>
      <el-button @click="onCancal">取消</el-button>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      form: {
        encoding: "",
        print: true,
        fieldDelimiter: "",
        path: "",
        fileName: "",
        recordNumBeforeSleep: 0,
        sleepTime: 0,
      },
    };
  },

  inject: {
    step: {
      default: () => {
        return {};
      },
    },
  },
  methods: {
    onSubmit() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          this.step.setAttrs(this.form);
          this.onCancal();
        }
      });
    },
    onCancal() {
      this.$emit("onCloseDialog");
    },
  },
};
</script>